home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / pc / files / dsp / 56000tar.z / 56000tar / 56000 / telecom / dtmf / dtmfmstr.asm < prev    next >
Assembly Source File  |  1992-04-28  |  7KB  |  595 lines

  1.     title    'MULTICHANNEL DTMF RECEIVER MAIN PROGRAM'
  2.  
  3. ;    SSI in network mode
  4.  
  5.     page    132,72,0,10
  6.  
  7. ;**************
  8.  
  9. ;;5/31/87 ; ec
  10.  
  11. ; dtmfmstr.asm
  12.  
  13. ;**************
  14.  
  15. ;  Multichannel DTMF receiver master program:
  16.  
  17. ;        -using the SSI in network mode 
  18.  
  19. ;      -the SCI is used to display the results
  20.  
  21. ;       
  22.  
  23. ;    Polled I/O version
  24.  
  25. ;
  26.  
  27.         opt     rc,mu,cc
  28.  
  29.  
  30.  
  31. dtmfmtr    ident    1,1    ;main
  32.  
  33.  
  34.  
  35. ; the following section define the location
  36.  
  37. ; of the data in the X & Y memories
  38.  
  39. ;
  40.  
  41. ;********************************
  42.  
  43.     section divers
  44.  
  45.     xdef    keybrd,pret,pos
  46.  
  47.     xdef    ratio,samples,misc
  48.  
  49.     xdef    energy,twogrp,wddr,cddr
  50.  
  51. ;
  52.  
  53. ;    Data in internal Y memory
  54.  
  55. ;
  56.  
  57.     org    xi:0
  58.  
  59. wddr    dsm    144        ; memory of all filters
  60.  
  61.     org    xi:$90
  62.  
  63. twogrp    dsm    12        ; high and low group input
  64.  
  65.     org    xi:$c0
  66.  
  67. energy    dsm    48        ; 6*8 energies
  68.  
  69. ;
  70.  
  71. ;    Data in internal Y memory    
  72.  
  73. ;
  74.  
  75.     org    yi:0
  76.  
  77. cddr    ds    60        ; filter coef.
  78.  
  79.     org    yi:$40
  80.  
  81. samples    ds    6        ; 6 input samples
  82.  
  83.     org    yi:$50
  84.  
  85. keybrd    ds    16        ; data for display
  86.  
  87. pret    ds    61        ; data for init display
  88.  
  89. pos    ds    18        ; data for display result
  90.  
  91. ratio    ds    1        ; energy division ratio
  92.  
  93.     org    yi:$f0
  94.  
  95. misc    dsm    12        ; 6 lastone,lastone-1
  96.  
  97. ;
  98.  
  99.     endsec
  100.  
  101. ;********************************
  102.  
  103. ;
  104.  
  105.     section    rezet
  106.  
  107. start    equ    $40    
  108.  
  109.     org    p:0
  110.  
  111.     jmp    <start
  112.  
  113.     endsec
  114.  
  115. ;
  116.  
  117. ;********************************
  118.  
  119.     section pcoeff
  120.  
  121.     xdef    pcddr
  122.  
  123. ;temporary storage of
  124.  
  125. ;filter coef. after bootstrap
  126.  
  127.     org    p:1
  128.  
  129. pcddr    dc    $0ac800,$11cc00,$fe9981,$2d8c00,$0ac180 
  130.  
  131.     dc    $1f6f00,$c4d101,$c69e81,$2fd480,$1f6380 
  132.  
  133.     dc    $160dc0,$e9f241,$13e480,$000000,$000000
  134.  
  135.     dc    $20237f,$eeda81,$1a6600,$296000,$201f80 
  136.  
  137.     dc    $015945,$000000,$c6605b,$3dbdab,$fea6bc
  138.  
  139.      dc    $01717e,$000000,$d3990e,$3d967b,$fe8e83 
  140.  
  141.     dc    $01a283,$000000,$e334fc,$3d4579,$fe5d7e 
  142.  
  143.     dc    $01b643,$000000,$f46a6f,$3d22a6,$fe49be 
  144.  
  145.     dc    $021262,$000000,$282537,$3c7574,$fded9f 
  146.  
  147.     dc    $022cfe,$000000,$3ea63c,$3c5603,$fdd303 
  148.  
  149.     dc    $025efc,$000000,$54846e,$3c03c1,$fda105 
  150.  
  151.     dc    $0295d0,$000000,$67b680,$3bad5b,$fd6a31
  152.  
  153.     endsec
  154.  
  155. ;
  156.  
  157. ;********************************
  158.  
  159. ; the following section transferts data 
  160.  
  161. ; from P to Y memory after the bootstrap
  162.  
  163. ;
  164.  
  165.     section    transfert
  166.  
  167.     xref    keybrd,pkeybrd,cddr,pcddr
  168.  
  169. ;
  170.  
  171.     org    pli:
  172.  
  173.     move    #keybrd,r4
  174.  
  175.     move    #pkeybrd,r0
  176.  
  177.     do    #96,end_trf
  178.  
  179.     move    p:(r0)+,x0
  180.  
  181.     move    x0,y:(r4)+
  182.  
  183. end_trf
  184.  
  185.     move    #cddr,r4
  186.  
  187.     move    #pcddr,r0
  188.  
  189.     do    #60,end_trf1
  190.  
  191.     move    p:(r0)+,x0
  192.  
  193.     move    x0,y:(r4)+
  194.  
  195. end_trf1
  196.  
  197.  
  198.  
  199.     endsec
  200.  
  201. ;********************************
  202.  
  203. ;
  204.  
  205.     section    initperiph 
  206.  
  207.      nolist
  208.  
  209.     include '\dsp56000.asm\ioequ'        
  210.  
  211.     list
  212.  
  213.     org    pli:
  214.  
  215. ;
  216.  
  217. ; SSI configuration:
  218.  
  219. ; -network mode;internal clock;synchronous mode.
  220.  
  221. ; -does not use interrupt but RDF/TDE flags.
  222.  
  223. ; -Alaw expansion is using algln11 and 
  224.  
  225. ;  DSP56001 internal data ROM address X:$180
  226.  
  227. ;
  228.  
  229. ;
  230.  
  231. acc     equ     $2222           ; external access time X_Y_P_IO
  232.  
  233. ;
  234.  
  235. ;  SSI setup
  236.  
  237. ;**************
  238.  
  239. ps      equ     0<<M_PSR        ; change 0 to 1 for divide by 8
  240.  
  241. wl      equ     0<<M_WL0        ; change 0 to 3/1/2 for 24/12/16 bits/word
  242.  
  243. dc      equ     26<<8           ; used for 27 slots/frame in NW
  244.  
  245. pm      equ     2               ; to gen the 8x27(cdc)x8(bit)=1.728MHz rate
  246.  
  247. ;**************
  248.  
  249. ;  SCI setup
  250.  
  251. ;**************
  252.  
  253. wl0    equ    6<<M_WDS0    
  254.  
  255. sbk    equ    0<<M_SBK
  256.  
  257. ;
  258.  
  259. ; start
  260.  
  261. ;******
  262.  
  263. ; first program PORT A & OPERATING MODE
  264.  
  265. start    move    #$4,omr        ; mode 0 /ROM enable
  266.  
  267.         movep   #acc,x:M_BCR    ; wait states
  268.  
  269. ;***********
  270.  
  271. ; ssi setup
  272.  
  273. ;***********
  274.  
  275. ; step 1 of initialization of SSI is RESET ( already performed )
  276.  
  277. ; step 2 of initialization of SSI
  278.  
  279. ; start programming the SSI
  280.  
  281.         movep   #(ps|wl|dc|pm),x:M_CRA  ; PSR=0 , WL=0 , DC=19 , PM=3
  282.  
  283.         movep   #>$0A3C,x:M_CRB         ; RIE=0 , TIE=0 , RE=0  , TE=0
  284.  
  285.                                         ; MOD=0 , GCK=0 , SYN=1 , FSL=1
  286.  
  287.                                         ; *     , *     , SCKD=1, SCD2=1,
  288.  
  289.                                         ; SCD1=1, SCD0=1, OF1=0 , OF0=0
  290.  
  291. ; start programming the SCI
  292.  
  293.     movep    #(sbk|wl0),x:M_SCR
  294.  
  295.         bset    #M_TE,x:M_SCR           ; enable the transmitter ( WDS=0 )
  296.  
  297.         movep   #269,x:M_SCCR           ; CD=269 for divide by 270
  298.  
  299.                     ; 320k/270=1185 baud #1200 baud)
  300.  
  301. ; enable the SSI
  302.  
  303.     bclr    #4,x:M_PCDDR        ;sc1/pc4 input    ack
  304.  
  305.     bclr    #1,x:M_PCDDR        ;txd/pc1 input  busy
  306.  
  307.     bset    #0,x:M_PCDDR        ;PC0 output  reset
  308.  
  309.         movep   #$1e4,x:M_PCC           ; set CC(8:3) as SSI pins
  310.  
  311.                                         ; set CC(2;1) as SCI pins
  312.  
  313.      endsec
  314.  
  315. ;
  316.  
  317. ;********************************
  318.  
  319.     section    main1
  320.  
  321.     org    pli:
  322.  
  323.  
  324.     nolist
  325.  
  326.     include '\dsp56000.asm\ioequ'        
  327.  
  328.     list
  329.  
  330. ;
  331.  
  332.     xdef    rien,enc
  333.  
  334.     xref    ready,misc,keybrd,pret,ret,pos,num,temp
  335.  
  336. ;
  337.  
  338. ; misc. init
  339.  
  340. ;
  341.  
  342.     bclr     #0,x:M_PCD        ; start reset display
  343.  
  344.     jsr    temp            ;temp
  345.  
  346.     bset     #0,x:M_PCD        ;end reset display
  347.  
  348.     jsr    temp            ;temp
  349.  
  350.  
  351.     move    #pret,r6    ;for ready message
  352.  
  353.     move    #61,n6        ;on the display
  354.  
  355.     jsr    ready        ;go to write to display
  356.  
  357. ;
  358.  
  359.     move    #8,n2        ;offset for energies      
  360.  
  361.     move    #2,n5        ;offset for detect/last/lastone
  362.  
  363. ;
  364.  
  365.     move    #(6*$18)-1,m0    ;modulo 8f for filter samples
  366.  
  367.     move    #11,m1        ;r1 mod 12 for two groups
  368.  
  369.     move    #(6*8)-1,m2    ;modulo 48 for energies
  370.  
  371.     move    #$3b,m4        ;modulo 3b for filter coefficient
  372.  
  373.     move    #$b,m5        ;modulo 12 for last-1 & lastone
  374.  
  375. ;
  376.  
  377.     move    #misc+1,r5     ; r5-> former detections
  378.  
  379.     rep    #12
  380.  
  381.     bset    #16,y:(r5)+    ;last one &last-2= bidon
  382.  
  383. ;
  384.  
  385. rien
  386.  
  387. enc
  388.  
  389.     endsec
  390.  
  391. ;********************************
  392.  
  393. ;
  394.  
  395.     section    detect 
  396.  
  397. ;     the linker will insert the 
  398.  
  399. ;        detection routine
  400.  
  401.     endsec
  402.  
  403. ;
  404.  
  405. ;********************************
  406.  
  407.     section    main2
  408.  
  409.     org    pli:
  410.  
  411.     xref    ready,misc,keybrd,pret,ret,pos,num,enc
  412.  
  413. ;
  414.  
  415.     nolist
  416.  
  417.     include '\dsp56000.asm\ioequ'        
  418.  
  419.     list
  420.  
  421. ;
  422.  
  423.     move    #keybrd,r7    ;r7 -> ASCII code table
  424.  
  425.     move     #pos,r6
  426.  
  427.     move    #3,n6
  428.  
  429.     move    #2,n3
  430.  
  431.     move    #$40,n4        
  432.  
  433.     move    #>1,y1
  434.  
  435. ;
  436.  
  437.     do    #6,_edwrt
  438.  
  439.  
  440.     jset    #$10,x:(r5),ryen    ;nothing if no detection
  441.  
  442. ;    
  443.  
  444. ; compare with last detection
  445.  
  446. ;
  447.  
  448.     move    x:(r5),y0        ;y0 = detected number
  449.  
  450.     move    y:(r5)-,b        ; b = last one
  451.  
  452.     move    y:(r5),a        ; a = last -2
  453.  
  454.     move     b,y:(r5)+        ; last one -> last -2
  455.  
  456.     cmp    y0,a    y0,y:(r5)    ;y0 -> last one
  457.  
  458.     jeq    <ryen            ;nothing if y0 =last-2
  459.  
  460.     cmp    y0,b            ;compare y0 with last one
  461.  
  462.     jne    <enk            ;double dectect necessary
  463.  
  464. ;
  465.  
  466. ; number detected and written
  467.  
  468. ;
  469.  
  470.     move    y0,n7            ;n7=  detected number
  471.  
  472. ;
  473.  
  474.     lua    (r5)-,r5
  475.  
  476.     move    r6,r3
  477.  
  478.     move    y:(r7+n7),x0    ;x0= ascii code of detected number
  479.  
  480.     move    x0,y:(r3+n3)    ;write code to RS232 terminal
  481.  
  482.     jsr    ready            ;go to write to display
  483.  
  484.     lua    (r6)-n6,r6
  485.  
  486.     move    n4,a
  487.  
  488.     jmp    <paseff        ; go to another detection
  489.  
  490. ;    
  491.  
  492. ryen    move    y:(r5)-,a    ;lastone->last-2
  493.  
  494.     move    a,y:(r5)+
  495.  
  496.     bset    #16,y:(r5)-    ;last one=bidon
  497.  
  498.     move    x:(r5),a
  499.  
  500.     sub    y1,a
  501.  
  502.     jne    <paseff
  503.  
  504.     move    r6,r3
  505.  
  506.     move    #>$20,x0
  507.  
  508.     move    x0,y:(r3+n3)
  509.  
  510.     jsr    ready            ;go to write to display
  511.  
  512.     lua    (r6)-n6,r6
  513.  
  514.     move    #$ffffff,a
  515.  
  516. paseff    move    a,x:(r5)+
  517.  
  518. ;
  519.  
  520. enk    lua    (r5)+n5,r5
  521.  
  522.     lua    (r6)+n6,r6
  523.  
  524. ;
  525.  
  526. _edwrt
  527.  
  528.     jmp    <enc
  529.  
  530.     endsec
  531.  
  532. ;
  533.  
  534. ;********************************
  535.  
  536. ;    section containing data
  537.  
  538. ;    to be transfered to the Y
  539.  
  540. ;    memory after the bootstrap
  541.  
  542. ;
  543.  
  544.     section    PtoYmem
  545.  
  546.     xdef    pkeybrd
  547.  
  548.     org    pli:
  549.  
  550. pkeybrd    dc    '1','2','3','A','4','5','6','B','7','8','9'
  551.  
  552.     dc    'C','*','0','#','D'    
  553.  
  554. ppret    dc    $0e,$1b,0,'D','I','A','L','E','R','1',':'
  555.  
  556.     dc    $1b,$0D,'D','I','A','L','E','R','2',':'
  557.  
  558.     dc    $1b,$1A,'D','I','A','L','E','R','3',':'
  559.  
  560.     dc    $1b,$80,'D','I','A','L','E','R','4',':'
  561.  
  562.     dc    $1b,$8D,'D','I','A','L','E','R','5',':'
  563.  
  564.     dc    $1b,$9A,'D','I','A','L','E','R','6',':'
  565.  
  566. ppos    dc    $1b,$00+$0A,
  567.  
  568.     dc    $1b,$0D+$0A,
  569.  
  570.     dc    $1b,$1A+$0A,
  571.  
  572.     dc    $1b,$80+$0A,
  573.  
  574.     dc    $1b,$8D+$0A,
  575.  
  576.     dc    $1b,$9A+$0A,
  577.  
  578. pratio    dc    0.0125        ;1/80
  579.  
  580. ;
  581.  
  582.     endsec
  583.  
  584. ;
  585.  
  586.     end
  587.  
  588.  
  589.  
  590.  
  591.  
  592.